#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
int a[20], book[20], n = 4;

void dfs(int k) {
    if (k >= n) {
        cout << a[0] << a[1] << a[2] << a[3] << endl;
        return;
    }
    for (int i = 0; i < n; i++) {
        a[k] = i;
        dfs(k + 1);
    }


}


int main() {
    dfs(0);

    return 0;
}
